package mypack;

import org.apache.hadoop.conf.Configurable;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.mapreduce.Partitioner;

public class PopulationPartitioner extends Partitioner <IntWritable, Chromosome> implements Configurable
{	
	@Override
	public int getPartition(IntWritable key, Chromosome value, int numOfPartitions) {
		
		System.out.println("before partition "+key.get() );
		int partition = key.get() % numOfPartitions;
		System.out.println("after partition "+partition );
		return partition;
	}

	@Override
	public Configuration getConf() {
		// TODO Auto-generated method stub
		return conf;
	}

	@Override
	public void setConf(Configuration arg0) {
		// TODO Auto-generated method stub
		conf = arg0;
		
	}
	
	private Configuration conf;
}
